= form_for [:merchant, @product] do |f|
  - if @product.new_record?
    = hidden_field_tag :mbox_id, @mbox.id
  .form-group
    = f.label :name, t(".name"), class: "control-label"
    = f.text_field :name, class: "form-control"
    - unless f.object.errors[:name].blank?
      span class="error"
        = f.object.errors[:name].join(",")
  .form-group
    = f.label :product_photo, t(".product_photo"), class: "control-label"
    - unless @product.product_photo.blank?
      = image_tag @product.product_photo.url
    = f.file_field :product_photo, class: "form-control"
    - unless f.object.errors[:product_photo].blank?
      span class="error"
        = f.object.errors[:product_photo].join(",")
  .form-group
    = f.label :price, t(".price"), class: "control-label"
    = f.text_field :price, class: "form-control"
    - unless f.object.errors[:price].blank?
      span class="error"
        = f.object.errors[:price].join(",")
  .form-group
    = f.label :description, t(".description"), class: "control-label"
    = f.text_area :description, class: "form-control"
    - unless f.object.errors[:product_photo].blank?
      span class="error"
        = f.object.errors[:product_photo].join(",")
  .form-group
    .row
      .col-md-6
        = f.label :hot, t(".hot") + "?"
      .col-md-6.col-offset-6
        = f.check_box :hot
  .form-actions
    - if @product.new_record?
      = f.submit "添加产品", class: "btn"
    - else
      = f.submit "修改产品", class: "btn"
